function shallowReadonly (obj){
  return new Proxy(obj, {
    get (obj,key){
      return obj[key]
    },
    set(obj,key,val){
      /* obj[key] =val
      return true */
      console.log(key,'第一层数据是只读的，不能修改')
    }
  })
}

const obj = {
  a:'a',
  gf:{
    b:'b',
    f:{
      c:'c',
      s:{
        d:'d'
      }
    }
  }
}
let state = shallowReadonly (obj)
state.a = 1
state.a.gf.b = 3